package com.iflytek.aisol.audit.iflytek.strategy.manage.mapper.fr;

import com.iflytek.aisol.audit.iflytek.strategy.manage.entity.FrGrayConfigServerInstance;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface FrGrayConfigServerInstanceMapper extends JpaRepository<FrGrayConfigServerInstance, Long> {
    @Modifying
    @Query("DELETE FROM FrGrayConfigServerInstance g WHERE g.grayConfigId = :grayConfigId")
    void deleteByGrayId(Long grayConfigId);

    @Query("SELECT g FROM FrGrayConfigServerInstance g WHERE g.serverInstanceId = :id")
    List<FrGrayConfigServerInstance> findWithInstanceId(@Param("id") Long id);
}
